﻿namespace MyCharacterGame
{
    internal class Program
    {
        const int countofTest = 10;
        static void Main(string[] args)
        {
            //定义出错次数
            int countofError = 0;
            //随机数对象
            Random rm = new Random();
            DateTime StartTime = DateTime.Now;
            for (int i = 1; i <= countofTest; i++)
            {
              //起始时间
               
                Console.Clear();
                Console.WriteLine("这是第{0}次实验",i);            
                char x = (char)rm.Next(65, 90);
                //输出随机数
                Console.WriteLine(x);
                //定义标志变量
                bool Flag = true;
                do
                {
                    char input= Console.ReadKey().KeyChar;
                    if (input == x)
                        break;
                    else
                    {
                        countofError++;
                        Flag = false;
                    }
                } while (Flag==true);
               

            }
            DateTime EndTime = DateTime.Now;
            TimeSpan timeofReaction = EndTime - StartTime;
            Console.WriteLine("总耗时{0}秒", timeofReaction);
            Console.WriteLine("共错误{0}次", countofError);

            Console.ReadKey();
        }
    }
}